package edu.hunau.cxb19.oop.class08.abstracts;

/**
 *
 * @author hb
 *
 *         2020-03-04 14:57:24
 */
public class Circle extends Shape {

	private int r;

	/**
	 * @param location
	 * @param r
	 */
	public Circle(Point location, int r) {
		super(location);
		this.r = r;
	}

	public Circle() {
		super();
	}

	@Override
	public double area() {

		return this.r * this.r * Math.PI;
	}

	@Override
	public boolean contains(Point p) {
		// 获得点到圆心的距离
		return this.getLocation().distance(p) <= this.r;
	}

}
